package com.example.mobile2121606110syc0510homework;

import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;

import androidx.appcompat.app.AppCompatActivity;

public class MainActivity extends AppCompatActivity {

    private TextView tvMainTitle;
    private EditText edtTxtMainUsername;
    private EditText edtTxtMainPassword;
    private EditText edtTxtMainPassword2;
    private EditText edtTxtMainTelephone;
    private EditText edtTxtMainEmail;
    private EditText edtTxtMainDate;
    private Button btnMainRegister;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
        initView();
        btnMainRegister.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(MainActivity.this,RegisterActivity.class);
                intent.putExtra("username",edtTxtMainUsername.getText().toString().trim());
                intent.putExtra("telephone",edtTxtMainTelephone.getText().toString().trim());
                intent.putExtra("email",edtTxtMainEmail.getText().toString().trim());
                intent.putExtra("date",edtTxtMainDate.getText().toString().trim());
                startActivity(intent);
            }
        });
    }

    private void initView() {
        tvMainTitle = (TextView) findViewById(R.id.tvMainTitle);
        edtTxtMainUsername = (EditText) findViewById(R.id.edtTxtMainUsername);
        edtTxtMainPassword = (EditText) findViewById(R.id.edtTxtMainPassword);
        edtTxtMainPassword2 = (EditText) findViewById(R.id.edtTxtMainPassword2);
        edtTxtMainTelephone = (EditText) findViewById(R.id.edtTxtMainTelephone);
        edtTxtMainEmail = (EditText) findViewById(R.id.edtTxtMainEmail);
        edtTxtMainDate = (EditText) findViewById(R.id.edtTxtMainDate);
        btnMainRegister = (Button) findViewById(R.id.btnMainRegister);
    }
}